<?php
namespace Tbf\Bundle\TestBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * 上tag管理
 */
class TestCompilerPass implements CompilerPassInterface
{
    /**
     * You can modify the container here before it is dumped to PHP code.
     *
     * @param ContainerBuilder $container
     *
     * @api
     */
    public function process(ContainerBuilder $container)
    {
        $this->handleDbalLogger($container);
    }
    private function handleDbalLogger(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('doctrine.dbal.logger.chain')) {
            return;
        }
        /*
        不好用..
        $logger_chain = $container->getDefinition('doctrine.dbal.logger.chain');
        $logger_chain->setMethodCalls(array());
        $logger_chain->addMethodCall(
            'addLogger',
            array(new Reference('tbf_test.dbal_logger'))
        );
        */
    }
}
